package com.study.scala.collections.list

import scala.beans.BeanProperty

class Worker2 extends Ordering[Worker2]{
  
  @BeanProperty
  var name: String="zsc";
  @BeanProperty
  var salary:Int=0;
  
  def this(name:String){
    this();
    this.name=name;
  }
  
   def this(name:String,salary:Int){
    this(name);
    this.salary=salary;
  }
   
  override def toString():String={
     "name:"+name+"****salary:"+salary
   }
  
  override def compare(x: Worker2, y: Worker2): Int = {
      x.getSalary() - y.getSalary()
    }
}

